<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="parent">
        <p>diyige </p>
    </div>
    <script>
        // 从父元素的前面插入一个节点
        // insertBefore(newChild.oldChild)
        var parent=document.getElementById("parent");
        var p=document.createElement("p");
        var txt=document.createTextNode("第0滴血");
        p.appendChild(txt);
        console.log(p);
        parent.insertBefore(p,parent.firstElementChild);

    </script>

</body>

</html>